// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

const TcbRouter = require('tcb-router')

const db = cloud.database()

const classicCollection = db.collection('classic')

const MAX_LIMIT = 100

// 云函数入口函数
exports.main = async (event, context) => {
  const app = new TcbRouter({
    event
  })

  app.router('list', async (ctx, next) => {
    let classicList = await classicCollection.where({}).get().then((res) => {
      return res.data
    })
    ctx.body = classicList
  })
  return app.serve()
}